\(\int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx\) [52]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 28, antiderivative size = 30 \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {(b+a \cot (c+d x))^3 \tan ^3(c+d x)}{3 b d} \]

[Out]

1/3*(b+a*cot(d*x+c))^3*tan(d*x+c)^3/b/d

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.071, Rules used = {3167, 37} \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {\tan ^3(c+d x) (a \cot (c+d x)+b)^3}{3 b d} \]

[In]

Int[Sec[c + d*x]^4*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

((b + a*Cot[c + d*x])^3*Tan[c + d*x]^3)/(3*b*d)

Rule 37

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(a + b*x)^(m + 1)*((c + d*x)^(n +
1)/((b*c - a*d)*(m + 1))), x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[m + n + 2, 0] && NeQ
[m, -1]

Rule 3167

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> Dist[-d^(-1), Subst[Int[x^m*((b + a*x)^n/(1 + x^2)^((m + n + 2)/2)), x], x, Cot[c + d*x]], x] /; FreeQ[
{a, b, c, d}, x] && IntegerQ[n] && IntegerQ[(m + n)/2] && NeQ[n, -1] &&  !(GtQ[n, 0] && GtQ[m, 1])

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {(b+a x)^2}{x^4} \, dx,x,\cot (c+d x)\right )}{d} \\ & = \frac {(b+a \cot (c+d x))^3 \tan ^3(c+d x)}{3 b d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.53 \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {a^2 \tan (c+d x)}{d}+\frac {a b \tan ^2(c+d x)}{d}+\frac {b^2 \tan ^3(c+d x)}{3 d} \]

[In]

Integrate[Sec[c + d*x]^4*(a*Cos[c + d*x] + b*Sin[c + d*x])^2,x]

[Out]

(a^2*Tan[c + d*x])/d + (a*b*Tan[c + d*x]^2)/d + (b^2*Tan[c + d*x]^3)/(3*d)

Maple [A] (verified)

Time = 0.99 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.60

method result size
derivativedivides \(\frac {a^{2} \tan \left (d x +c \right )+\frac {a b}{\cos \left (d x +c \right )^{2}}+\frac {b^{2} \sin \left (d x +c \right )^{3}}{3 \cos \left (d x +c \right )^{3}}}{d}\) \(48\)
default \(\frac {a^{2} \tan \left (d x +c \right )+\frac {a b}{\cos \left (d x +c \right )^{2}}+\frac {b^{2} \sin \left (d x +c \right )^{3}}{3 \cos \left (d x +c \right )^{3}}}{d}\) \(48\)
parts \(\frac {a^{2} \tan \left (d x +c \right )}{d}+\frac {b^{2} \sin \left (d x +c \right )^{3}}{3 d \cos \left (d x +c \right )^{3}}+\frac {a b \sec \left (d x +c \right )^{2}}{d}\) \(53\)
risch \(-\frac {2 i \left (6 i a b \,{\mathrm e}^{4 i \left (d x +c \right )}-3 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}+3 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+6 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}-6 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 a^{2}+b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}\) \(99\)
parallelrisch \(-\frac {2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4} a^{2}-2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3} a b +\left (-2 a^{2}+\frac {4 b^{2}}{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) a b +a^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{3} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{3}}\) \(111\)
norman \(\frac {\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}}{d}-\frac {2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}-\frac {8 b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 d}-\frac {8 b^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{3 d}+\frac {4 \left (3 a^{2}-4 b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{3 d}-\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{d}+\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{d}-\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{3} \left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{2}}\) \(206\)

[In]

int(sec(d*x+c)^4*(cos(d*x+c)*a+b*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*tan(d*x+c)+a*b/cos(d*x+c)^2+1/3*b^2*sin(d*x+c)^3/cos(d*x+c)^3)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.83 \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {3 \, a b \cos \left (d x + c\right ) + {\left ({\left (3 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + b^{2}\right )} \sin \left (d x + c\right )}{3 \, d \cos \left (d x + c\right )^{3}} \]

[In]

integrate(sec(d*x+c)^4*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

1/3*(3*a*b*cos(d*x + c) + ((3*a^2 - b^2)*cos(d*x + c)^2 + b^2)*sin(d*x + c))/(d*cos(d*x + c)^3)

Sympy [F]

\[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\int \left (a \cos {\left (c + d x \right )} + b \sin {\left (c + d x \right )}\right )^{2} \sec ^{4}{\left (c + d x \right )}\, dx \]

[In]

integrate(sec(d*x+c)**4*(a*cos(d*x+c)+b*sin(d*x+c))**2,x)

[Out]

Integral((a*cos(c + d*x) + b*sin(c + d*x))**2*sec(c + d*x)**4, x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.50 \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {b^{2} \tan \left (d x + c\right )^{3} + 3 \, a^{2} \tan \left (d x + c\right ) - \frac {3 \, a b}{\sin \left (d x + c\right )^{2} - 1}}{3 \, d} \]

[In]

integrate(sec(d*x+c)^4*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

1/3*(b^2*tan(d*x + c)^3 + 3*a^2*tan(d*x + c) - 3*a*b/(sin(d*x + c)^2 - 1))/d

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.37 \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {b^{2} \tan \left (d x + c\right )^{3} + 3 \, a b \tan \left (d x + c\right )^{2} + 3 \, a^{2} \tan \left (d x + c\right )}{3 \, d} \]

[In]

integrate(sec(d*x+c)^4*(a*cos(d*x+c)+b*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/3*(b^2*tan(d*x + c)^3 + 3*a*b*tan(d*x + c)^2 + 3*a^2*tan(d*x + c))/d

Mupad [B] (verification not implemented)

Time = 21.59 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.27 \[ \int \sec ^4(c+d x) (a \cos (c+d x)+b \sin (c+d x))^2 \, dx=\frac {\frac {b^2\,\sin \left (c+d\,x\right )}{3}+\frac {{\cos \left (c+d\,x\right )}^2\,\sin \left (c+d\,x\right )\,\left (3\,a^2-b^2\right )}{3}+a\,b\,\cos \left (c+d\,x\right )\,{\sin \left (c+d\,x\right )}^2}{d\,{\cos \left (c+d\,x\right )}^3} \]

[In]

int((a*cos(c + d*x) + b*sin(c + d*x))^2/cos(c + d*x)^4,x)

[Out]

((b^2*sin(c + d*x))/3 + (cos(c + d*x)^2*sin(c + d*x)*(3*a^2 - b^2))/3 + a*b*cos(c + d*x)*sin(c + d*x)^2)/(d*co
s(c + d*x)^3)